from django.db import models


class RemoteOJ(models.Model):
    name = models.CharField(max_length=30, unique=True, verbose_name="OJ名称")
    baseurl = models.URLField(max_length=200, null=False, blank=False, verbose_name="OJ地址")

    picture = models.ImageField(null=True, blank=True,verbose_name="OJ图片",upload_to="static/remoteoj/picture/")
    description = models.TextField(null=True, blank=True,verbose_name="OJ简介")


    is_active = models.BooleanField(default=True, verbose_name="是否可用")
    comment = models.JSONField(max_length=200, null=True, blank=True, verbose_name="备注")

    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now_add=True, verbose_name='更新时间')
    is_delete = models.BooleanField(default=False, verbose_name='删除标记')

    def __str__(self):
        return self.name

    class Meta:
        ordering = ["id"]
        db_table = 'remote_oj_list'
